diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2023-12-06 17:47:41 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2023-12-06 18:57:35 -0500 |
| commit | e747ec3ea02dd01e9ffa9e398e24e6939a5b738c (patch) | |
| tree | 7f66d981effe2f51192ab7562d6c36ecdce459c1 /src/app/groups/[groupId]/balances/page.tsx | |
| parent | 12b1cdb52a9d2723c319083b45a4e9a21896b3b4 (diff) | |
Tabs
Diffstat (limited to 'src/app/groups/[groupId]/balances/page.tsx')
| -rw-r--r-- | src/app/groups/[groupId]/balances/page.tsx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/app/groups/[groupId]/balances/page.tsx b/src/app/groups/[groupId]/balances/page.tsx new file mode 100644 index 0000000..24818c9 --- /dev/null +++ b/src/app/groups/[groupId]/balances/page.tsx @@ -0,0 +1,41 @@ +import { BalancesList } from '@/app/groups/[groupId]/balances-list' +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from '@/components/ui/card' +import { getGroup, getGroupExpenses } from '@/lib/api' +import { getBalances } from '@/lib/balances' +import { notFound } from 'next/navigation' + +export default async function GroupPage({ + params: { groupId }, +}: { + params: { groupId: string } +}) { + const group = await getGroup(groupId) + if (!group) notFound() + + const expenses = await getGroupExpenses(groupId) + const balances = getBalances(expenses) + + return ( + <Card className="mb-4"> + <CardHeader> + <CardTitle>Balances</CardTitle> + <CardDescription> + This is the amount that each participant paid or was paid for. + </CardDescription> + </CardHeader> + <CardContent> + <BalancesList + balances={balances} + participants={group.participants} + currency={group.currency} + /> + </CardContent> + </Card> + ) +} |
